﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartSiteManagementSystem.Models.GeneticProgram
{
    /// <summary>
    /// 生成随机数
    /// </summary>
    public sealed class MyRandom : Random
    {
        private object sync = new object();

        public MyRandom()
        {
        }
        public override int Next()
        {
            lock (sync) return base.Next();
        }
        public override int Next(int maxValue)
        {
            lock (sync) return base.Next(maxValue);
        }
        public override int Next(int minValue, int maxValue)
        {
            lock (sync) return base.Next(minValue, maxValue);
        }
        public override void NextBytes(byte[] buffer)
        {
            lock (sync) base.NextBytes(buffer);
        }
        public override double NextDouble()
        {
            lock (sync) return base.NextDouble();
        }
    }
}
